-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide local testing functionality #172
Conversation
- Spins up a Dataverse installation similar to the test action - Allows to specify the version of Python to test against
A note here: wouldn't it make sense to require folks to run the integration tests using pytest on their machine (potentially using poetry) and use sth like Testcontainers for Python to run a Compose config? It's the same thing as within the upstream codebase: using Testcontainers lets you regain control over service dependencies from within testing and not rely on outside control scripts. |
I agree, running Dataverse and tests independently would be great! I've gone with this solution mainly due to retrieving the API Token and ingesting it into the testing workflow. It replicates what the Dataverse action does and leaves the "technicalities" to the bash script. My main concern with going for an independent solution would be that users still need a way to extract the API Token into their environment for tests to run successfully. Effectively, this would always require some intermediate script since I am not able to hardcode this into tests. Thanks for the repo! Maybe re-structuring the tests around Testcontainers and parsing the logs could work. I will check the repo out tomorrow - Enough "Nachtschicht" for today 😁 |
Hey @kuriwaki and @wibeasley you might want something like this for https://github.com/IQSS/dataverse-client-r |
@poikilotherm @pdurbin, I just wanted to give you a quick update. I've been working on the Can you test or review the recent additions? |
Changes this PR introduces
run-tests.sh
script-p
flagWhy this change is required
ToDos
How to run the tests
In order to run the tests, you need to have a Dataverse instance running. We have prepared a shell script that will start a Dataverse instance using Docker that runs all tests in a clean environment. To run the tests, execute the following command:
Once finished, you can find the test results in the
dv/unit-tests.log
file and in the terminal.Manual setup
If you want to run single tests you need to manually set up the environment and set up the necessary environment variables. Please follow the instructions below.
1. Start the Dataverse instance
2. Set up the environment variables
3. Run the test(s) with pytest
Closes #169